home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 326-350 / disk_337 / cmanual / screens.lzh / Screens / Example1.c < prev    next >
C/C++ Source or Header  |  1990-01-30  |  3KB  |  91 lines

  1. /* Example1                                                              */
  2. /* This program will open a low-resolution, non-Interlaced, eight colour */
  3. /* Custom Screen. It will display it for 30 secondes, and then close it. */
  4.  
  5.  
  6.  
  7. /* If your program is using Intuition you should include intuition.h: */
  8. #include <intuition/intuition.h>
  9.  
  10.  
  11.  
  12. struct IntuitionBase *IntuitionBase;
  13.  
  14.  
  15.  
  16. /* Declare a pointer to a Screen structure: */ 
  17. struct Screen *my_screen;
  18.  
  19. /* Declare and initialize your NewScreen structure: */
  20. struct NewScreen my_new_screen=
  21. {
  22.   0,            /* LeftEdge  Should always be 0. */
  23.   0,            /* TopEdge   Top of the display.*/
  24.   320,          /* Width     We are using a low-resolution screen. */
  25.   200,          /* Height    Non-Interlaced NTSC (American) display. */
  26.   3,            /* Depth     8 colours. */
  27.   0,            /* DetailPen Text should be drawn with colour reg. 0 */
  28.   1,            /* BlockPen  Blocks should be drawn with colour reg. 1 */
  29.   NULL,         /* ViewModes No special modes. (Low-res, Non-Interlaced) */
  30.   CUSTOMSCREEN, /* Type      Your own customized screen. */
  31.   NULL,         /* Font      Default font. */
  32.   "MY SCREEN",  /* Title     The screen' title. */
  33.   NULL,         /* Gadget    Must for the moment be NULL. */
  34.   NULL          /* BitMap    No special CustomBitMap. */
  35. };
  36.  
  37.  
  38.  
  39. main()
  40. {
  41.   /* Before we can use the functions in the Intuition Library we need */
  42.   /* to open it. (See chapter 0 INTRODUCTION for more information.)   */
  43.   IntuitionBase = (struct IntuitionBase *)
  44.     OpenLibrary( "intuition.library", 0 );
  45.   
  46.   if( IntuitionBase == NULL )
  47.     exit(); /* Could NOT open the Intuition Library! */
  48.   
  49.  
  50.  
  51.   /* We will now try to open the screen: */
  52.   my_screen = (struct Screen *) OpenScreen( &my_new_screen );
  53.   
  54.   /* The "(struct Screen *)" is not necessary but it tells the compiler */
  55.   /* that the function OpenScreen() returns a pointer to a Screen       */
  56.   /* structure. (See chapter 0 INTRODUCTION for more information about  */
  57.   /* casting.)                                                          */
  58.  
  59.   /* Have we opened the screen succesfully? */
  60.   if(my_screen == NULL)
  61.   {
  62.     /* Could NOT open the Screen! */
  63.     
  64.     /* Close the Intuition Library since we have opened it: */
  65.     CloseLibrary( IntuitionBase );
  66.  
  67.     exit();  
  68.   }
  69.  
  70.  
  71.  
  72.   /* We have opened the screen, and everything seems to be OK. */
  73.  
  74.   /* Wait for 30 seconds: */
  75.   Delay( 50 * 30);
  76.   
  77.   /* Delay(time) is a function which stops the process for a while.      */
  78.   /* "time" is the number of ticks it should wait. (50 ticks per second) */
  79.  
  80.  
  81.  
  82.   /* We should always close the screens we have opened before we leave: */
  83.   CloseScreen( my_screen );
  84.  
  85.  
  86.   
  87.   /* Close the Intuition Library since we have opened it: */
  88.   CloseLibrary( IntuitionBase );
  89.   
  90.   /* THE END */
  91. }